<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>元素节点的属性和方法</title>
    <style>
        .box1 {
            width: 200px;
            height: 200px;
            background-color: red;
        }
    </style>
</head>

<body>
    <input class="i1" type="text" name="username" value="admine" placeholder="输入账号">
    <script>
        const input = document.getElementsByTagName("div")[0]

        // 用属性
        console.log(input.type)
        console.log(input.className)    //class属性需要通过className来读取
        console.log(input.disabled)     // 读取一个布尔值时，会返回true或者false

        // 用方法
        input.setAttribute("placeholder", "请输入您的账号")
        input.setAttribute("value", "请把原来的删除")

        console.log(input.getAttribute("placeholder"))
        input.setAttribute("disabled", false)     // disable时用来禁用表单项
        input.removeAttribute("disabled")
    </script>
</body>

</html>